package com.doubao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.doubao.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper extends BaseMapper<User> {

    /**
     * 更新智能体数量
     */
    @Update("UPDATE user SET smart_device_count = smart_device_count + #{count} WHERE id = #{userId}")
    int updateDeviceCount(@Param("userId") Long userId, @Param("count") int count);

    /**
     * 更新用户状态
     */
    @Update("UPDATE user SET status = #{status} WHERE id = #{userId}")
    int updateStatus(@Param("userId") Long userId, @Param("status") Integer status);
}
